package com.kaili.basic.service.impl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.kaili.basic.pojo.entity.BaseGasStation;
import com.kaili.basic.mapper.BaseGasStationMapper;
import com.kaili.basic.service.BaseUserService;
import com.kaili.basic.service.BasicSiteService;
import com.kaili.basic.service.IBaseGasStationService;
import com.kaili.common.util.LoginDetailUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author fzj
 * @since 2018-04-25
 */
@Service
public class BaseGasStationServiceImpl extends ServiceImpl<BaseGasStationMapper, BaseGasStation> implements IBaseGasStationService {

    @Autowired
    private BaseGasStationMapper baseGasStationMapper;

    @Autowired
    private BasicSiteService basicSiteService;

    @Autowired
    private BaseUserService baseUserService;


    @Override
    public int addBaseGasStation(BaseGasStation baseGasStation) {
        Long createBy = LoginDetailUtils.getCurrentEmployeeId().longValue();
        baseGasStation.setCreateBy(createBy);
        baseGasStation.setCreateTime(new Date());
        return baseGasStationMapper.addBaseGasStation(baseGasStation);
    }

    @Override
    public int updateBaseGasStation(BaseGasStation baseGasStation) {
        Long modifyBy = LoginDetailUtils.getCurrentEmployeeId().longValue();
        baseGasStation.setModifyBy(modifyBy);
        baseGasStation.setModifyTime(new Date());
        return baseGasStationMapper.updateBaseGasStation(baseGasStation);
    }

    @Override
    public int deleteBaseGasStation(BaseGasStation baseGasStation) {
        Long modifyBy = LoginDetailUtils.getCurrentEmployeeId().longValue();
        baseGasStation.setModifyBy(modifyBy);
        baseGasStation.setModifyTime(new Date());
        return baseGasStationMapper.deleteBaseGasStation(baseGasStation);
    }

    @Override
    public List<BaseGasStation> getBaseGasStationByKeywords(String stationName) {
        return baseGasStationMapper.getBaseGasStationByKeywords(stationName);
    }

    @Override
        public BaseGasStation getBaseGasStationByName(String stationName) {
        return baseGasStationMapper.getBaseGasStationByName(stationName);
    }
}
